<?xml version="1.0"?>
<jsp:root 	xmlns:jsp="http://java.sun.com/JSP/Page"
			xmlns:c="http://java.sun.com/jsp/jstl/core"
			xmlns:fn="http://java.sun.com/jsp/jstl/functions"
			version="2.1">
	<jsp:directive.page contentType="text/html; charset=UTF-8" />
	<jsp:directive.page isELIgnored="false" />
	<jsp:output omit-xml-declaration="false"
		doctype-root-element="html"
		doctype-public="-//W3C//DTD XHTML 1.1//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd" />
	<jsp:directive.page import="es.albarregas.modelo.Cliente" />
	<jsp:directive.page import="es.albarregas.modelo.ModelFacade"/>
	<jsp:useBean id="clienteBean" class="es.albarregas.beans.ClienteBean" scope="session" />	
	<c:forEach var="campos" items="${param}">
		<c:if test="${fn:length(campos.value)==0}">
			<c:set var="error" value="1" />
		</c:if>
	</c:forEach>
	<jsp:setProperty name="clienteBean" property="*" />	
	<c:choose>
		<c:when test="${error==1}">
			<jsp:forward page="${pageContext.request.pathInfo}/Secciones/modificarDatos.jsp">
				<jsp:param value="where codigo=${clienteBean.codigo}" name="clausula" />
				<jsp:param value="1" name="error"/>
			</jsp:forward>
		</c:when>
		<c:otherwise>
			<jsp:scriptlet>
				Cliente cliente = ModelFacade.crearCliente(clienteBean, false);
				request.setAttribute("cliente", cliente);
			</jsp:scriptlet>
			<c:choose>
				<c:when test="${cliente==null}">
					<jsp:forward page="${pageContext.request.pathInfo}/Secciones/errorOperacion.jsp">
						<jsp:param value="actual" name="lugar" />
					</jsp:forward>
				</c:when>
				<c:otherwise>
					<jsp:forward page="VisDatosCliente.jsp">
						<jsp:param value="actual" name="lugar" />
					</jsp:forward>
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
</jsp:root>